import sys

def strxor(a, b):     # xor two strings of different lengths
    if len(a) > len(b):
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])
    else:
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])

def random(size=16):
    return open("/dev/urandom").read(size)

def encrypt(key, msg):
    c = strxor(key, msg)
    print
    print c.encode('hex')
    return c

m1 = "Pay Bob 100$"
m2 = "Pay Bob 500$"
ct = "20814804c1767293b99f1d9cab3bc3e7".decode('hex')
key = strxor(m1, m2)
encrypt(key, ct)
#     20814804c1767293bd9f1d9cab3bc3e7 ac1e37bfb15599e5f40eef805488281d 